var  client = require('../database');
function  User(user) {
    this.name = user.username;
    this.password = user.password;
}
var tableName = "admin";
mysql = client.getDbCon();
module.exports = User;

//login
User.login =  function  login(username,password, callback) {
    var sql = "select * from admin c where c.username='"+username+"' and c.password='"+password+"'" ;
      mysql.query(sql,function(err,results,fields){
            if(err){
                throw err;
            }else{
                callback(err,results[0]);
            }
        })
};   